<%@page import="org.beanstech.persistence.Tbluser"%>
<%@page import="org.beanstech.dao.UserDao"%>
<%@include file="header.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@page import="org.beanstech.model.SystemModel"%>
<%@page import="java.util.List"%>
<%@page import="java.util.*"%>
<%@page import="org.beanstech.dao.DropDownConstructDao"%>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<link rel="stylesheet" href="css/main.css" type="text/css" />
	<link type="text/css" href="css/jquery-ui-1.8.18.custom.css" rel="stylesheet" />	
	<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
	<script type="text/javascript" src="js/custom.js"></script>
	<script type="text/javascript">
	
	 
	$(document).ready(function()
		{
		
					$( "#datepicker" ).datepicker({ dateFormat: "yy-mm-dd" });
		
		 
			$("#divCountry").change(function()
			{
			var id=$(this).val();
			
			 $.getJSON('RegistrationRequestServlet',{"q":id,"entity":"state"},listStateCallback);	
			});
			
			$("#divState").change(function()
					{
					var id=$(this).val();
					
					 $.getJSON('RegistrationRequestServlet',{"q":id,"entity":"city"},listCityCallback);	
					});
				
			$("#divUniveristy").change(function()
					{
					var id=$(this).val();
					
					 $.getJSON('RegistrationRequestServlet',{"q":id,"entity":"college"},listCollegeCallback);	
					});
			$("#divCity").change(function()
					{
				var id=$(this).val();
				
				 $.getJSON('RegistrationRequestServlet',{"q":id,"entity":"locality"},listLocalityCallback);	
				});	
		 
			}
			
			
	

	
	);
	function listStateCallback(data){
        var listHTML = "";
        $.each(data, function(i, car) {
            listHTML += "<option value='" + car["id"] + "'>"+car["name"]+"</option>";
           //listHTML += "<li>" + car["name"] + "</li>";
        });
        //alert(listHTML);
        $("#divState").html(listHTML);
       
	}
	
	function listCityCallback(data){
        var listHTML = "";
        $.each(data, function(i, car) {
            listHTML += "<option value='" + car["id"] + "'>"+car["name"]+"</option>";
           //listHTML += "<li>" + car["name"] + "</li>";
        });
        //alert(listHTML);
        $("#divCity").html(listHTML);
       
	}
	
	function listCollegeCallback(data){
		 var listHTML = "";
	        $.each(data, function(i, car) {
	            listHTML += "<option value='" + car["id"] + "'>"+car["name"]+"</option>";
	           //listHTML += "<li>" + car["name"] + "</li>";
	        });
	        //alert(listHTML);
	        $("#divCollege").html(listHTML);
	       
	}
	
	function listLocalityCallback(data){
		 var listHTML = "";
	        $.each(data, function(i, car) {
	            listHTML += "<option value='" + car["id"] + "'>"+car["name"]+"</option>";
	           //listHTML += "<li>" + car["name"] + "</li>";
	        });
	        //alert(listHTML);
	        $("#divLocality").html(listHTML);
	       
	}
	</script>
	<%
		
		DropDownConstructDao dropdown = new DropDownConstructDao();
		List<SystemModel> customlist = dropdown.getCountryList();
		int userid = Integer.parseInt(request.getParameter("userid"));
		UserDao doa = new UserDao();
		Tbluser user = doa.getUserById(userid);
		
	%>
	<title>Second Book Exchange | Effort towards Green Campaign</title>
</head><body>
	
		<div id="full_div_text">
		<div class="mydiv">
 		<h2>Complete your profile in easy two steps</h2>
		</div>
		<div class="mydiv">
		<div class="mydiv_left" >
		<a href="page2.html"><img src="images/gif_btn_1.gif" />Fill your basic details</a></div>
		<div class="mydiv_right">
		<a href="page2_step2.html"><img src="images/gif_btn_2.gif" /> Fill the Secondary Details</a>
		</div>
		</div>
		<div class="mydiv">
		<form action="Registration" method="post" enctype="multipart/form-data">
		 <input type="hidden" name="userid" value="<%=userid%>"/>
		<table align="center">
		<tr>
		<td class="tdFont">First Name</td>
			<td align="right">
			<div class="loginboxdiv">
  				<input class="loginbox" name="fname" type="text" autocomplete="off" />
			</div>
			</td>
		</tr>
		<tr>
		<td class="tdFont">Last Name</td>
			<td align="right">
			<div class="loginboxdiv">
  				<input class="loginbox" name="lname" type="text" autocomplete="off"/>
			</div>
			</td>
		</tr>
		
		<tr>
		<td class="tdFont">Mobile No. </td>
			<td align="right">
			<div class="loginboxdiv">
  				<input class="loginbox" name="mobile" type="text" />
			</div>
			</td>
		</tr>
		
		<tr>
		<td class="tdFont">Email Id </td>
			<td align="right">
			<div class="loginboxdiv">
  				<input class="loginbox" name="email" type="text" value="<%=user.getEmailid() %>" readonly="readonly"/>
			</div>
			</td>
		</tr>
		<tr>
		<td class="tdFont">Date of Birth </td>
			<td align="right">
			<div class="loginboxdiv">
  				
  				<select name="date" class="date" >
  				<option value="">Date</option>
  				<%for(int i = 1;i<=31;i++){ %>
  				<option value="<%=i%>"><%=i %></option>
  				<%} %>
  				
  				
  				</select>
  				<select name="month"  class="date">
  				<option value="">Month</option>
  				<option value="Jan">January </option>
  				<option value="Feb">February </option>
  				<option value="Mar">March </option>
  				<option value="Apr">April </option>
  				<option value="May">May </option>
  				<option value="Jun">June </option>
  				<option value="Jul">July</option>
  				<option value="Aug">August</option>
  				<option value="Sep">September</option>
  				<option value="Oct">October</option>
  				<option value="Nov">November</option>
  				<option value="Dec">December</option>
  				
  				
  				</select>
  				<select name="year" class="date">
  				<option value="">Year</option>
  				<%for(int i = 2012;i>=1940;i--){ %>
  				<option value="<%=i%>"><%=i %></option>
  				<%} %>
  				
  				</select>
  				
			</div>
			
			</td>
		</tr>
		</tr>
		<tr>
		<td class="tdFont">Country </td>
			<td align="right">
			<div>
  				<select name="country" class="divstyled" id="divCountry">
  				<%for(Iterator i = customlist.iterator();i.hasNext();){
  					SystemModel sys = (SystemModel)i.next();
  					%>
  					<option value="<%=sys.getId()%>"><%=sys.getName() %></option>
					<%} %>
				</select>
			</div>
			</td>
		</tr>

		
		
		<tr>
		<td class="tdFont">State </td>
			<td align="right">
			<div >
  				<select name="state" class = "divstyled" id="divState">
					
				</select>
			</div>
			</td>
		</tr>
		<tr>
		<td class="tdFont">City </td>
			<td align="right">
			<div>
  				<select name="city" class = "divstyled" id="divCity" >
					
				</select>
			</div>
			</td>
		</tr>
		<tr>
		<td class="tdFont">Gender </td>
			<td align="right">
			<div >
  				<select name="gender" class = "divstyled" >
					<option value="1">Male</option>
					<option value="2">Female</option>
					
				</select>
			</div>
			</td>
		</tr>
		<tr>
		<td class="tdFont">University </td>
			<td align="right">
			<div >
  				<select name="uni" class = "divstyled" id="divUniveristy">
					<%customlist = dropdown.getUniversitiesList();
					for(Iterator i = customlist.iterator(); i.hasNext();){
						SystemModel model = (SystemModel)i.next();
						%>
						<option value="<%=model.getId()%>"><%=model.getName() %></option>
						<%} %>
				</select>
			</div>
			</td>
		</tr>
		<tr>
		<td class="tdFont">College </td>
			<td align="right">
			<div >
  				<select name="College" class="divstyled" id="divCollege">
					
				</select>
			</div>
			</td>
		</tr>
		<tr>
		<td class="tdFont">Course </td>
			<td align="right">
			<div>
  				<select name="Course" class="divstyled" id="divCourse">
					 <%customlist = dropdown.getCourseList();
					for(Iterator i = customlist.iterator(); i.hasNext();){
						SystemModel model = (SystemModel)i.next();
						%>
						<option value="<%=model.getId()%>"><%=model.getName() %></option>
						<%} %>
					 
				</select>
			</div>
			</td>
		</tr>
		<tr>
		<td class="tdFont">Locality </td>
			<td align="right">
			<div >
  				<select name="locality" class="divstyled" id="divLocality">
					
				</select>
			</div>
			</td>
		</tr>
		<tr>
		<td class="tdFont">Member Type </td>
			<td align="right">
			<div>
  				<select name="member" class="divstyled" id="divMemberType">
					<%customlist = dropdown.getMemberTypeList(); 
					for(Iterator i = customlist.iterator();i.hasNext();){
						SystemModel model = (SystemModel)i.next();
						%>
						<option value="<%=model.getId()%>"> <%=model.getName() %></option>
						<%} %>
				</select>
			</div>
			</td>
		</tr>
		<tr>
		<td class="tdFont">Study Type </td>
			<td align="right" >
			<div >
  				<select name="type" class="divstyled" id="divStudyType">
					<%customlist = dropdown.getStudentTypeList(); 
					for(Iterator i = customlist.iterator();i.hasNext();){
						SystemModel model = (SystemModel)i.next();
						%>
						<option value="<%=model.getId()%>"> <%=model.getName() %></option>
						<%} %>
				</select>
			</div>
			</td>
		</tr>
		<tr>
		<td class="tdFont">Upload Your Photo</td>
		<td align="right">
			<div class="loginboxdiv">
				<input type="file" />
			</div>
		</td>
		</tr>
		
		<tr>
		
		<td colspan="2" align="right">
			<input type="submit" value="submit" src="images/jpg_btn_next.jpg"/>
  			</td>
		</tr>
		</table>
		</form>
		</div>		
		
		</div>
		<div id="text">
			
			
			
			
		</div>
		
		
		

		<div id="green_bubble">
			<p><a href="#">Testimonials</a><a href="#">FAQ's</a><a href="#">Terms &amp; Conditions </a><a href="#">Feedback</a><a href="#">Contact</a></p>
		</div>
	</div>

	<div id="footer">
		<div class="wrap">
			<div id="bubble">
			  <p>Testimonials</p>
			  <p>"Hi, What a fab web-site.It is such a waste of money storing the used books"</p>
			</div>
			<div id="copyright">
				<p>Copyright &copy; 2011  Second Book Exchange  <a title="Awsome Web Templates" href="http://www.solucija.com/"></a></p>
			</div>
			<div class="clear"></div>
		</div>
	</div>
</body>
</html>